package test;

import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.crypto.password.StandardPasswordEncoder;



public class Crypt {
	//java -jar jacksum.jar -a sha -q "txt:123456"

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String password = "admin";
		PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
		String hashedPassword = passwordEncoder.encode(password);
		System.out.println("hashedPassword=" + hashedPassword);


		passwordEncoder = new StandardPasswordEncoder();
		hashedPassword = passwordEncoder.encode(password);
		System.out.println("hashedPassword1=" + hashedPassword);

		System.out.println("admin=" + DigestUtils.sha1Hex("admin"));
		System.out.println("user1=" + DigestUtils.sha1Hex("user1"));
		System.out.println("user2=" + DigestUtils.sha1Hex("user2"));
		System.out.println("user3=" + DigestUtils.sha1Hex("user3"));
		System.out.println("user4=" + DigestUtils.sha1Hex("user4"));
		System.out.println("user5=" + DigestUtils.sha1Hex("user5"));

/*		MessageDigest cript = MessageDigest.getInstance("SHA-1");
        cript.reset();
        cript.update(password.getBytes("utf8"));


        hashedPassword = new String(Hex.encodeHex(cript.digest()),
                CharSet.forName("UTF-8"));*/
	}

}
